//
//  EFBPDFDestoryedView.m
//  muefb
//
//  Created by Chu yanling on 12/17/12.
//
//

#import "EFBPDFDestoryedView.h"

@interface EFBPDFDestoryedView()

@property (nonatomic, retain) UITapGestureRecognizer *tapped;

@end


@implementation EFBPDFDestoryedView
@synthesize label=_label;
@synthesize noUpdateNotificator=_noUpdateNotificator;
@synthesize tapped=_tapped;
@synthesize delegate;
@synthesize fullScreen;

-(void)dealloc
{
    [_tapped release];
    [_label release];
    [_noUpdateNotificator release];
    [super dealloc];
}


- (id)initWithFrame:(CGRect)frame andErrorTitle:(NSString *)title
{
    self = [super initWithFrame:frame];
    if (self) {
        
        self.backgroundColor=[UIColor whiteColor];
        
        _label = [[UILabel alloc] initWithFrame:CGRectMake(0, 10, 568, 75)];
        _label.backgroundColor = [UIColor clearColor];
        _label.lineBreakMode = NSLineBreakByWordWrapping;
        _label.numberOfLines = 2;
        _label.textColor = [UIColor whiteColor];
        _label.textAlignment = NSTextAlignmentCenter;
        _label.font = [UIFont systemFontOfSize:24.0f];
        if (title) {
            _label.text =title;
        }else{
            _label.text = NSLocalizedString(@"chart-destory",@"该航图PDF已损坏");
            
        }
        
        _noUpdateNotificator = [[UIView alloc] initWithFrame:CGRectMake((frame.size.width-568)/2,frame.size.height*0.5,568,100)];
        
        _noUpdateNotificator.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin;
        _noUpdateNotificator.backgroundColor = [UIColor blackColor];
        _noUpdateNotificator.layer.masksToBounds = YES;
        _noUpdateNotificator.layer.cornerRadius = 15.0;
        _noUpdateNotificator.layer.borderWidth = 1.0;
        _noUpdateNotificator.alpha=0.7;
        [_noUpdateNotificator addSubview:_label];
        
        _tapped=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(actionTapped:)];
        
        [self addGestureRecognizer:_tapped];
        [self addSubview:_noUpdateNotificator];
        
    }
    
    return self;
}

-(void)actionTapped:(id)sender
{
    fullScreen=!fullScreen;
    [delegate hiddenTabbar:fullScreen];

}



/*
 // Only override drawRect: if you perform custom drawing.
 // An empty implementation adversely affects performance during animation.
 - (void)drawRect:(CGRect)rect
 {
 // Drawing code
 }
 */

@end
